<?php
/*
 * Create Lastest games widget
* */
class Show_online extends WP_Widget
{
	function Show_online()
	{
		parent::WP_Widget('Show_online',
				__("Thống kê truy cập"),
				array('description' => __("Kéo thả vào trong sidebar phải",THEMENAME)));

	}

	function widget( $args, $instance ) // hien thi noi dung widget
	{
		extract($args);
		$title = apply_filters( 'widget_title',
				empty($instance['title']) ? '' : $instance['title'],
				$instance, $this->id_base);
		?>		
		<div class="module">
			<div>
				<div>
					<div>
						<h3><span style="line-height: 45px;"><?php echo $title;?></span></h3>
						   <div id="content">
							<div class="whois">
								Hiện có&nbsp;<strong><?php echo db_soluongonline();?> khách</strong>&nbsp;Trực tuyến <br/>
								Đã có&nbsp;<strong><?php print_r(bt_soluongtruycap());?> khách</strong>&nbsp;truy cập
							</div>
                    		</div>
					</div>
				</div>
			</div>
		</div>
		<?php 
	}

	function update( $new_instance, $old_instance ) 
	{
		$instance = $old_instance;
				
		$instance['title'] = strip_tags($new_instance['title']);		
		return $instance;
	}

	function form( $instance ) 
	{
		$instance = wp_parse_args( (array) $instance, 
			array( 'title' => ''));
		$title = strip_tags($instance['title']);		
				
	?>
			<p>
				<label for="<?php echo $this->get_field_id('title'); ?>">
					<?php echo  __('Tiêu đề:',THEMENAME); ?> </label>
				<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" 
					name="<?php echo $this->get_field_name('title'); ?>" type="text" 
					value="<?php if($title) echo  esc_attr($title);?>" />
			</p>				
									
	<?php
	}
}
// Register Widgets
register_widget('Show_online');
// End Widget Lastest_games
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++